<?php

namespace Trawind\Rocketmq\Manage;


use AlibabaCloud\SDK\Ons\V20190214\Models\OnsTopicStatusResponse;
use AlibabaCloud\SDK\Ons\V20190214\Ons;
use Darabonba\OpenApi\Models\Config;

abstract class Manage
{


    protected $onsClient;


    protected function getOnsClient()
    {
        if (!$this->onsClient instanceof Ons) {
            $config = new Config([
                "accessKeyId" => config('queue.connections.rocketmq.access_id'),
                "accessKeySecret" => config('queue.connections.rocketmq.access_key'),
                "regionId" => config('queue.connections.rocketmq.region_id'),
            ]);
            $this->onsClient = new Ons($config);
        }
        return $this->onsClient;
    }


    public static function getData(OnsTopicStatusResponse $response)
    {
        return $response->body->data;
    }
}